package tests;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	static Scanner scanner;
	static MySQLConnector mySQLConnector;
	static String[] user = {"1.管理员登陆", "2.用户登录", "0.退出系统"};

	public static void main(String[] args) {
		scanner = new Scanner(System.in);
		try {
			mySQLConnector = new MySQLConnector(scanner);
		}catch (Exception e){
			System.out.println("数据库连接失败");
			return;
		}
		System.out.println("******欢迎使用电影推荐系统******");
		while (true) {
			try {
				switch (mySQLConnector.reader.selectMenu(user, true,true)) {
					case 1:
						mySQLConnector.adminMenu();
						continue;
					case 2:
						mySQLConnector.userMenu();
						continue;
					case 0:
						break;
				}
				break;
			} catch (InputMismatchException e) {
				return;
			} catch (RuntimeException e) {
				System.out.println(e.getMessage());
			}
		}
		System.out.println("******期待您再次使用本系统，再见******");
	}
}